package task5;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/5/4 8:58
 * @description:
 */
public class CopyFile {

  public static void main(String[] args) throws Exception {
    /*1.创建字符缓冲流对象：需要通过基本字符流来构造*/
    BufferedReader br=new BufferedReader(new FileReader("a.txt"));
    BufferedWriter bw=new BufferedWriter(new FileWriter("c:\\aa.txt"));
    /*2.通过字符缓冲流对象去一次读写一行文本*/
    //定义读取的字符串
    String line=null;
    while((line=br.readLine())!=null){
      //将读取的一行字符串写入目的文件
      bw.write(line);
      //添加一个分行符
      bw.newLine();
    }
    br.close();
    bw.close();
  }

}
